#ifndef __LEXER_H
#define __LEXER_H 1


#include <string>
#include <regex>

#include <token.h>



class Lexer {
 private:
  const char *_chunk;
  size_t _left;
  int _line, _col;

  bool _cached;
  Token _cache_token;
  Token _peek;

 public:
  Lexer(const char *buf, size_t size);
  bool test(const std::string& t) const;
  void walk(int n);
  void skip_comment();

  void skip_white_spaces();
  Token next_token();
  Token do_get_token();
  char scanChar(); 
  std::string scanString();
  std::string scan(const std::regex& reg);

  Token next_token_of_kind(int kind);
  Token next_identifier();
  int look_ahead();
  const Token& look_back() { return _peek; }
  int line() const { return _line; }
};


#endif // __LEXER_H


